package com.alan.service.impl;

import com.alan.entity.RestBean;
import com.alan.entity.dto.ScheduleUpdateDto;
import com.alan.mapper.ScheduleMapper;
import com.alan.service.ScheduleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ScheduleServiceImpl implements ScheduleService {

    @Resource
    private ScheduleMapper mapper;

    @Override
    public RestBean updateSchedule(ScheduleUpdateDto scheduleUpdateDto) {
        int res = mapper.updateById(scheduleUpdateDto.getUserId(),
                scheduleUpdateDto.getListId(),
                scheduleUpdateDto.getLearned(),
                scheduleUpdateDto.getNdtolearn());
        if (res == 1)
            return RestBean.success();
        else {
            return RestBean.failure("出错了，请联系管理员");
        }
    }
}
